<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>index</title>
    <script src="../static/js/163-angular.min.js"></script>
    <script src="../static/js/index.js"></script>
    <link rel="stylesheet" href="../static/css/style.css" type="text/css" />
</head>
<body>
<h1>请假管理</h1>
<p>
    <a href="/user">user</a>
    <a href="/exit">exit</a>
</p>
<div ng-app="vacApp">
    <div ng-controller="writeCtrl">
        <h2>我要请假</h2>
        <table border="0">
            <tr>
                <td>
                    我由于<input type="text" ng-model="reason"/>要请假<input type="number" min="1" ng-model="days"/>天。
                </td>
                <td>
                    <button ng-click="applyVac()">确定请假</button>
                </td>
            </tr>
        </table>
    </div>
    <div ng-controller="myVacCtrl">
        <h2 ng-init="myVac()">我正在申请的假</h2>
        <table border="0">
            <tr>
                <td>时间</td>
                <td>天数</td>
                <td>事由</td>
                <td>申请状态</td>
            </tr>
            <tr ng-repeat="vac in vacList">
                <td>{{vac.applyTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{vac.days}}</td>
                <td>{{vac.reason}}</td>
                <td>{{vac.applyStatus}}</td>
            </tr>
        </table>
    </div>
    <div ng-controller="myVacRecord">
        <h2 ng-init="myVacRecord()">我申请过的假</h2>
        <table border="0">
            <tr>
                <td>时间</td>
                <td>申请人</td>
                <td>天数</td>
                <td>事由</td>
                <td>申请状态</td>
                <td>审核人</td>
                <td>审核结果</td>
                <td>审核时间</td>
            </tr>
            <tr ng-repeat="vac in vacRecordList">
                <td>{{vac.applyTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{vac.applyUser}}</td>
                <td>{{vac.days}}</td>
                <td>{{vac.reason}}</td>
                <td>{{vac.applyStatus}}</td>
                <td>{{vac.auditor}}</td>
                <td>{{vac.result}}</td>
                <td>{{vac.auditTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
            </tr>
        </table>
    </div>
    <div ng-controller="myAudit">
        <h2 ng-init="myAudit()">待我审核的请假</h2>
        <table border="0">
            <tr>
                <td>任务名称</td>
                <td>任务时间</td>
                <td>申请人</td>
                <td>申请时间</td>
                <td>天数</td>
                <td>事由</td>
                <td>操作</td>
            </tr>
            <tr ng-repeat="vacTask in vacTaskList">
                <td>{{vacTask.name}}</td>
                <td>{{vacTask.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{vacTask.vac.applyUser}}</td>
                <td>{{vacTask.vac.applyTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{vacTask.vac.days}}</td>
                <td>{{vacTask.vac.reason}}</td>
                <td>
                    <button type="button" ng-click="passAudit(vacTask.id, 1)">审核通过</button>
                    <button type="button" ng-click="passAudit(vacTask.id, 0)">审核拒绝</button>
                </td>
            </tr>
        </table>
    </div>
    <div ng-controller="myAuditRecord">
        <h2 ng-init="myAuditRecord()">我的审核记录</h2>
        <table border="0">
            <tr>
                <td>时间</td>
                <td>申请人</td>
                <td>天数</td>
                <td>事由</td>
                <td>申请状态</td>
                <td>审核人</td>
                <td>审核结果</td>
                <td>审核时间</td>
            </tr>
            <tr ng-repeat="vac in auditVacRecordList">
                <td>{{vac.applyTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                <td>{{vac.applyUser}}</td>
                <td>{{vac.days}}</td>
                <td>{{vac.reason}}</td>
                <td>{{vac.applyStatus}}</td>
                <td>{{vac.auditor}}</td>
                <td>{{vac.result}}</td>
                <td>{{vac.auditTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
            </tr>
        </table>
    </div>
</div>
</body>
</html>